package com.lottery.game.core.model.dto.game;

import com.lottery.game.common.BaseObject;
import com.lottery.game.common.utils.DateUtils;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
@Builder
@Getter
@Setter
@ApiModel(value = "玩法实体")
public class GameTypePlayingRelationTO extends BaseObject {
    /**
     * 博彩编号
     */
    @Id
    @Column(name = "id")
    @GeneratedValue(generator = "JDBC")
    @ApiModelProperty(value = "博彩编号" ,example = "4bfac5eeb74d494eafe71f4f1dbfccd2")
    private String id;

    /**
     * 游戏类型编号
     */
    @Column(name = "game_type_id")
    @ApiModelProperty(value = "游戏类型编号" ,example = "0dc8c24b01944ea595296a0e8f31df2c")
    private String gameTypeId;

    /**
     * 游戏类型名称
     */
    @Column(name = "game_type_name")
    @ApiModelProperty(value = "游戏类型名称" ,example = "PC28系列")
    private String gameTypeName;

    /**
     * 玩法名称
     */
    @Column(name = "game_type_playing_name" )
    @ApiModelProperty(value = "玩法名称" ,example = "加拿大28")
    private String gameTypePlayingName;

    /**
     * 玩法编码
     */
    @Column(name = "game_type_playing_code")
    @ApiModelProperty(value = "玩法编码-BeiJing-ChongQing" ,example = "canada")
    private String gameTypePlayingCode;

    /**
     * 玩法编号
     */
    @Column(name = "game_type_playing_ticket")
    @ApiModelProperty(value = "游戏玩法编号" ,example = "2")
    private Integer gameTypePlayingTicket;

    /**
     * 图片地址
     */
    @Column(name = "game_type_playing_icon")
    @ApiModelProperty(value = "游戏背景图片地址" ,example = "http://103.104.105.25:8090/images/gameTypePlayingIcon/2019-4/fc4c6a2a-83a4-47e1-bcba-0f6276b0c23e.png")
    private String gameTypePlayingIcon;

    /**
     * 是否开放1 开放 0 不开放
     */
    @Column(name = "open")
    @ApiModelProperty(value = "是否开放1 开放 0 不开放",example = "true")
    private Boolean open;

    /**
     * 排序
     */
    @Column(name = "sort")
    @ApiModelProperty(value = "排序",example = "2")
    private Integer sort;

    /**
     * 开奖结果接口地址
     */
    @Column(name = "game_lottery_api_url")
    @ApiModelProperty(value = "开奖结果接口地址",example = "")
    private String gameLotteryApiUrl;

    /**
     * 维护开始时间 HH:mm
     */
    @Column(name = "maintenance_start_time")
    @ApiModelProperty(value = "维护开始时间 HH:mm",example = "18:58")
    private String maintenanceStartTime;

    /**
     * 维护结束时间 HH:mm
     */
    @Column(name = "maintenance_end_time")
    @ApiModelProperty(value = "维护结束时间 HH:mm",example = "19:59")
    private String maintenanceEndTime;

    /**
     * 是否维护
     */
    @ApiModelProperty(value = "是否维护",example = "false")
    private Boolean maintenance;

    /**
     * 游戏持续时间秒
     */
    @Column(name = "duration_time")
    @ApiModelProperty(value = "游戏持续时间秒",example = "150")
    private Long durationTime;

    /**
     * 开奖封盘时间秒
     */
    @Column(name = "closed_time")
    @ApiModelProperty(value = "开奖封盘时间秒",example = "60")
    private Long closedTime;

    public Boolean getMaintenance() {
        return DateUtils.isCurrentTimeIn(maintenanceStartTime, maintenanceEndTime);
    }

    @ApiModelProperty(value = "彩种游戏剩余倒计时",example = "150")
    private Long gameRemainingCountdown;

    @ApiModelProperty(value = "房间号",example = "1")
    private String rooMid;

    private CurrentGameIssue currentIssue;

}
